home *** CD-ROM | disk | FTP | other *** search
/ Everything For A Hacker / 19990506-[HACK].iso / NOVELL / SETPWD.RAR / SETPWD.C < prev    next >
Text File  |  1992-10-22  |  2KB  |  64 lines

  1. /*
  2.      SETPWD 1.0 - Sets a Novell User Password
  3.     Copyright (C) 1992  P.R.Lees
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 1, or any later version.
  8.  
  9.     This program is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU General Public License
  15.     along with this program; if not, write to the Free Software
  16.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.     
  18.     P.R.Lees@ais.salford.ac.uk
  19.     Network Systems Programmer
  20.     University of Salford
  21.     The Crescent
  22.     Salford
  23.     M5 4WT
  24.     
  25.     */
  26.  
  27.  
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30. #include <string.h>
  31. #include <errno.h>
  32. #include <process.h>
  33. #include <nwcntask.h>
  34. #include <nwbindry.h>
  35.  
  36. main(int argc,char *argv[])
  37. {
  38. int err;
  39. printf("[SetPwd.nlm (c) 1992 P.R.Lees]\n");
  40. if (argc!=3)
  41.     {
  42.     printf("Usage:\n\tLoad SetPwd <Username> <Password>\n");
  43.     exit(2);
  44.     }
  45.  
  46. err=ChangeBinderyObjectPassword(argv[1],OT_USER,"",strupr(argv[2]));
  47. if (err) 
  48.     {
  49.     switch(err)
  50.         {
  51.         case 150:printf("Server out of Memory\n");break;
  52.         case 215:printf("Password is not unique\n");break;
  53.         case 240:printf("Wildcard not allowed\n");break;
  54.         case 251:printf("No such Property\n");break;
  55.         case 252:printf("No such Object\n");break;
  56.         case 254:printf("Server bindery locked\n");break;
  57.         case 255:printf("No such object or Bad Password\n");break;
  58.         default:printf("Netware Error 0x%X (%d)\n",err,err);break;
  59.         }
  60.     exit(err);
  61.     }
  62. printf("Password of %s has been set to %s\n",strupr(argv[1]),strupr(argv[2]));
  63. exit(0);
  64. }